n = input()
stack = []
res = ""
for i in n:
    if i in "abcdefg":
        res += i
    elif i == '(':
        stack.append('(')
    elif i == ')':
        while stack[-1] != '(':
            res += stack.pop()
        stack.pop() # '('
    else:
        while stack and ((i in "*/" and stack[-1] in "+-") == False) and stack[-1] != '(':
            res += stack.pop()
        stack.append(i)

while stack :
    res += stack.pop()

print(res)











